<?php

/**
 * LigneTicketCaisse filter form base class.
 *
 * @package    SdCommerce
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseLigneTicketCaisseFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id_ticket_caisse'    => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('TicketCaisse'), 'add_empty' => true)),
      'id_stock_article'    => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('StockArticle'), 'add_empty' => true)),
      'id_foire'            => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Foire'), 'add_empty' => true)),
      'montant_ttc'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'quantite'            => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'designation_article' => new sfWidgetFormFilterInput(),
      'tva_article'         => new sfWidgetFormFilterInput(),
      'prix_unitaire'       => new sfWidgetFormFilterInput(array('with_empty' => false)),
    ));

    $this->setValidators(array(
      'id_ticket_caisse'    => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('TicketCaisse'), 'column' => 'id')),
      'id_stock_article'    => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('StockArticle'), 'column' => 'id')),
      'id_foire'            => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Foire'), 'column' => 'id')),
      'montant_ttc'         => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'quantite'            => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'designation_article' => new sfValidatorPass(array('required' => false)),
      'tva_article'         => new sfValidatorPass(array('required' => false)),
      'prix_unitaire'       => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
    ));

    $this->widgetSchema->setNameFormat('ligne_ticket_caisse_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'LigneTicketCaisse';
  }

  public function getFields()
  {
    return array(
      'id'                  => 'Number',
      'id_ticket_caisse'    => 'ForeignKey',
      'id_stock_article'    => 'ForeignKey',
      'id_foire'            => 'ForeignKey',
      'montant_ttc'         => 'Number',
      'quantite'            => 'Number',
      'designation_article' => 'Text',
      'tva_article'         => 'Text',
      'prix_unitaire'       => 'Number',
    );
  }
}
